#pragma once

namespace EndGameDB
{
	class TerminationException
	{};

	void ClearTerminationFlag();
	bool ShouldTerminate();
	void SetTerminationFlag();

#define CHECK_TERMINATE() { if(ShouldTerminate()) throw new TerminationException();  }

#define DECLARE_TERMINATE_PARALLEL() bool terminateThreads = false;
#define TERMINATE_PARALLEL()	terminateThreads
#define CHECK_TERMINATE_PARALLEL() { if(ShouldTerminate()) terminateThreads = true; }
#define IS_NOT_TERMINATE() if(terminateThreads == false)
#define TERMINATE_RAISE_EXCEPTION() if(terminateThreads == true) throw new TerminationException();

}